<?php
	/*
		this file just retransmits the data it recieves from post, but as a download
	*/
	
	require_once("../functions.php");
	
	if(!isLoggedIn()){
		echo "Please login first.";
		die();
	}
	
	if(!isset($_POST["content"])){
		die();
	}
	
	$content = $_POST["content"];
	
	header("Content-length: ". mb_strlen($content));
	header("Content-type: image/svg+xml");
	header("Content-Disposition: attachment; filename=diagram.svg");
	echo $content;
	exit;
?>